package com.test;

import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;
import java.util.Set;

/**
 * Created by HBZ on 2017/4/27.
 */
public class Nothing {
    public static void main(String[] args) {
        Properties pro = new Properties();
        int i=1;
        try {
            InputStream in = Nothing.class.getResourceAsStream("/app.properties");
            pro.load(in);
            Set<Object> set = pro.keySet();
            while (i<10000){
                for (Object o : set) {
                    String key = (String) o;
                    SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    try {
                        BufferedWriter out = null;
                        String dateFileName = "E:\\test1.txt";
                        out = new BufferedWriter(new OutputStreamWriter(
                                new FileOutputStream(dateFileName, true)));
                        out.write(sf.format(new Date()) + "-----" + pro.getProperty(key));
                        System.out.println(sf.format(new Date()) + "-----" + pro.getProperty(key));
                        out.newLine();//写入换行符
                        out.close();
                        Thread.sleep(2000);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
               /* File file = new File(pro.getProperty(key));
                if (file.exists()) {
                    if(file.isDirectory()){
                        File[] files = file.listFiles();
                        for (File temp : files) {
                            FileUtils.forceDelete(temp);
                            BufferedWriter out = null;
                            String dateFileName = "D:\\temp\\del.txt";
                            out = new BufferedWriter(new OutputStreamWriter(
                                    new FileOutputStream(dateFileName, true)));
                            out.write(temp.getName());
                            out.newLine();//写入换行符
                            out.close();
                            System.out.println(temp.getName());
                        }
                    }
                    else{
                        FileUtils.forceDelete(file);
                    }
                }*/

                }
                i++;
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
//        while (i<10000){
//            System.out.println("Hello World!--"+i);
//
//            SimpleDateFormat sf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//            try {
//                BufferedWriter out=null;
//                String dateFileName="E:\\test1.txt";
//                out = new BufferedWriter(new OutputStreamWriter(
//                        new FileOutputStream(dateFileName, true)));
//                out.write(sf.format(new Date()));
//                out.newLine();//写入换行符
//                out.close();
//                Thread.sleep(2000);
//            } catch (Exception e) {
//                e.printStackTrace();
//            }
//            i++;
//        }

    }
}
